package com.aliang.jp.baidu;

import java.awt.Rectangle;
import java.awt.image.BufferedImage;
import java.io.ByteArrayOutputStream;
import java.io.IOException;

import javax.imageio.ImageIO;

public class BaiDuOcrUtil {
	
	
	public static String ocr(BufferedImage im, Rectangle rct) {
		ByteArrayOutputStream byteout=new ByteArrayOutputStream();
		  try {
	            im = im.getSubimage(rct.x, rct.y, rct.width, rct.height);
	            
	            ImageIO.write(im,"bmp",byteout);
	            
	        } catch (IOException e1) {
	            e1.printStackTrace();
	        }

		return BaiduOcrDataHandel.dataHandelOpen(byteout.toByteArray());
	}
	
	

}
